<template>
    <el-row>
        <el-col :span="24">
            <el-form :inline="true"
                :model="newsSearchObj"
                class="search_prod tl">

                <el-form-item label="">
                    <el-input size="small"
                        clearable
                        v-model="newsSearchObj.oid_buy"
                        placeholder="买订单号"></el-input>
                </el-form-item>

                <el-form-item label="">
                    <el-input size="small"
                        clearable
                        v-model="newsSearchObj.username_1"
                        placeholder="买家账号"></el-input>
                </el-form-item>

                <el-form-item label="">
                    <el-input size="small"
                        clearable
                        v-model="newsSearchObj.nickname_1"
                        placeholder="买家昵称"></el-input>
                </el-form-item>

                <el-form-item label="">
                    <el-input size="small"
                        clearable
                        v-model="newsSearchObj.oid_sell"
                        placeholder="卖订单号"></el-input>
                </el-form-item>

                <el-form-item label="">
                    <el-input size="small"
                        clearable
                        v-model="newsSearchObj.username_2"
                        placeholder="卖方账号"></el-input>
                </el-form-item>

                <el-form-item label="">
                    <el-input size="small"
                        clearable
                        v-model="newsSearchObj.nickname_2"
                        placeholder="卖家昵称"></el-input>
                </el-form-item>

                <el-form-item label="">
                    <el-select v-model="newsSearchObj.status"
                        clearable
                        placeholder="请选择状态"
                        style="width:220px">
                        <el-option v-for="item in options"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item>
                    <el-button :loading='$store.state.isLoading'
                        size="small"
                        class="top_weiy"
                        type="primary"
                        @click="onSubmit">查询</el-button>
                    <el-button :loading='$store.state.isLoading'
                        size="small"
                        class="top_weiy"
                        type="primary"
                        @click="delSubmit">一键清除</el-button>
                </el-form-item>

            </el-form>
        </el-col>
    </el-row>
</template>
<script>
export default {
  name: "c2cBuySearch",
  data() {
    return {
      options: [
        {
          value: "1",
          label: "交易中"
        },
        {
          value: "2",
          label: "已付款"
        },
        {
          value: "3",
          label: "已完成"
        },
        {
          value: "4",
          label: "已取消"
        }
      ],

      pickerOptions2: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        }
      },
      newsSearchObj: {
        oid: "",
        username: "",
        nickname: "",
        status: ""
      },
      createTime: [],
      optionProps: {
        value: "id",
        label: "title",
        children: "z"
      },
      data: [],
      op: []
    };
  },
  methods: {
    delSubmit() {
      this.newsSearchObj = {
        oid: "",
        username: "",
        nickname: "",
        status: ""
      };
      this.$emit("sendSearch", this.newsSearchObj);
    },
    onSubmit() {
      console.log(this.newsSearchObj);
      this.$emit("sendSearch", this.newsSearchObj);
    }
  },
  created() {},
  watch: {
    createTime(val) {
      if (val != null) {
        this.newsSearchObj.created_time_begin = this.$fnc.phptime(val[0]);
        this.newsSearchObj.created_time_end = this.$fnc.phptime(val[1]);
      } else {
        this.newsSearchObj.created_time_begin = "";
        this.newsSearchObj.created_time_end = "";
      }
    }
  }
};
</script>
